import { defineStore } from "pinia";
import { Names } from "../../store-namespace";
import { _get, _post, _put, _delete, http } from "@/utils/axios";
import { BoardProcessPull } from "@/api/backend/index";

export const useBoardProcessPull = defineStore(Names.BoardProcessPull, {
  state: () => {
    return {
      single: <any>{},
      type: <any>[], //问题域的字典
      statusType: <any>[], //晨会问题状态的字典
      tags: <any>{},
      showMoreForm: false, //料号详情表单是否打开
    };
  },
  getters: {},
  actions: {
    //获取工序拉动看板列表数据
    getList(filter: any) {
      return new Promise((resolve, reject) => {
        _get(BoardProcessPull + "/list", filter, "json", "")
          .then((res: any) => {
            console.log("获取工序拉动看板列表数据", res);
            resolve(res);
          })
          .catch((err: any) => {
            console.log(err);
            reject(err);
          });
      });
    },
    //获取工序名称列表
    getListName(filter: any) {
      return new Promise((resolve, reject) => {
        _get(BoardProcessPull + "/queryProNameList", filter, "json", "")
          .then((res: any) => {
            resolve(res);
          })
          .catch((err: any) => {
            console.log(err);
            reject(err);
          });
      });
    },
    //获取机器型号列表
    getMtTypeList(filter: any) {
      return new Promise((resolve, reject) => {
        _get(BoardProcessPull + "/queryMtypeList", filter, "json", "")
          .then((res: any) => {
            resolve(res);
          })
          .catch((err: any) => {
            console.log(err);
            reject(err);
          });
      });
    },
  },
});
